package com.read.service.impl;

import com.read.dto.params.NovelCommentParamsDto;
import com.read.dto.params.NovelCommentReplyParamsDto;
import com.read.dto.params.NovelCommentStarParamsDto;
import com.read.dto.result.NovelCommentResultDto;
import com.read.mapper.NovelCommentMapper;
import com.read.mapper.NovelCommentReplyMapper;
import com.read.mapper.NovelCommentStarMapper;
import com.read.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sh-sunb6
 * @description
 * @date 2019-03-18 11:17
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private NovelCommentMapper novelCommentMapper;

    @Autowired
    private NovelCommentStarMapper novelCommentStarMapper;

    @Autowired
    private NovelCommentReplyMapper novelCommentReplyMapper;

    @Override
    public int userAddComment(NovelCommentParamsDto params) {
        return novelCommentMapper.userCommentNovel(params);
    }

    @Override
    public int userAddStar(NovelCommentStarParamsDto params) {
        return novelCommentStarMapper.userAddStar(params);
    }

    @Override
    public int userReplyComment(NovelCommentReplyParamsDto params) {
        return novelCommentReplyMapper.userReplyComment(params);
    }

    @Override
    public List<NovelCommentResultDto> selectComment(int novelId, int startPage, int pageSize) {

        return novelCommentMapper.selectComment(novelId, startPage, pageSize);
    }
}
